#ifndef TAG_QUEUE_HPP
#define TAG_QUEUE_HPP

#include "SqQueue.hpp"

class TagQueue : public SqQueueC {
public:
    TagQueue() {
        initQueue(q);
        tag = 0;
    }

    bool isEmpty() {
        return queueEmpty(q) && tag == 0;
    }

    bool isFull() {
        return queueEmpty(q) && tag == 1;
    }

    Status enTagQueue(QElemType e) {
        if (isFull()) {
            std::cout << "queue is full!" << std::endl;
            return Status::Err;
        }
        
        enQueue(q, e);
        if (q.rear == q.front) {
            tag = 1;
        }
        return Status::Ok;
    }

    Status deTagQueue(QElemType& e) {
        if (isEmpty()) {
            std::cout << "queue is empty" << std::endl;
            return Status::Err;
        }

        deQueue(q, e);

        if (q.front == q.rear) {
            tag = 0;
        }
        return Status::Ok;
    }
private:
    Queue q;
    int tag;
};


#endif
